package com.cz.datafetcher.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cz.datafetcher.common.ForginColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

@ApiModel(value="采集设备，电表等")
@Data
@TableName("fetchDevices")
public class FetchDevices implements Serializable {
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;

    @TableField(value = "fetchType")
    @ApiModelProperty("采集类型外键")
    @ForginColumn(table = "fetchTypes", primaryKeyColumn = "id",showColumn = "name",setClassField = "fetchTypeName")
    private Integer fetchType;

    @TableField(value = "fetchWays")
    @ApiModelProperty(value = "采集方式外键")
    //@NonNull
    @ForginColumn(table = "fetchWays",primaryKeyColumn = "id",showColumn = "name",setClassField = "fetchWaysName")
    private Integer fetchWays;

    @TableField(exist = false)
    @ApiModelProperty("采集方式名称，添加时不填")
    private String fetchWaysName;
    @TableField(exist = false)
    @ApiModelProperty("采集类型名称，添加时不填")
    private String fetchTypeName;

    @TableField(value = "name")
    @ApiModelProperty("名称")

    private String name;

    @TableField(value = "sn")
    @ApiModelProperty(value = "采集设备的设备序列号")
    private  String sn;

    @TableField(value = "deviceId")
    @ApiModelProperty("生产设备（被采集设备）的id，外键")
    @ForginColumn(table = "productionDevices",primaryKeyColumn = "id", showColumn = "name",setClassField = "deviceName")
    private String deviceId;

    @TableField(exist = false)
    @ApiModelProperty("所属生产设备名称，添加时不填")
    private String deviceName;

    @TableField(value = "enable")
    @ApiModelProperty(value = "true启用，false禁用")
    private boolean enable;

    @TableField(value = "platformid")
    @ApiModelProperty(value = "第三方平台对应id")
    private String platformid;

    @TableField(value = "beginValue")
    @ApiModelProperty(value = "期初值")
    private BigDecimal beginValue;

    @TableField(value = "period")
    @ApiModelProperty(value = "采集周期,秒")
    private Integer period;
}
